window.onload=function(){
	head();
}
function head(){
	var pbId = sessionStorage.getItem("pbId");
	var userId = sessionStorage.getItem("userId");
	console.log(userId);
	 $.ajax({
		    type:"POST",
		    url:"http://www.youyiku-yishu.cn/WebApp/AppOrders/index",
		    data:{userId:userId},
		    dataType:"json",
		     beforeSend: function (XMLHttpRequest) {
		         		XMLHttpRequest.setRequestHeader("DEVICEINFO", "JxRaZezavm3HXM3d9pWnYiqqQC1SJbsU");
		       }
		    }).then(data=>{
		    	
//				console.log(data)
	     		var goods=data.goods;
   				var cover=data.cover;
   				var personimg=data.personimg;
   				var shape=data.shape;
   				var Css=data.css;
   				var img=data.img;
              	var relation=data.relation;
              	var papersize=data.papersize;
              	var bookbinding=data.bookbinding;
             	var wuliu=data.wuLiu;
				var booksmes='';
				var paidOrder=data.paidOrder;
				if(paidOrder){
					for(var i=0;i<paidOrder.length;i++){
						booksmes+='<div class="Book">';
				 	       	booksmes+='<div class="book_main">';
              		booksmes+='<div class="book_img">';
					if(paidOrder[i].bookType==4){
                        booksmes+='<div class="photo_book">';
							if(paidOrder[i].personimg){
                                booksmes+='<div class="imgbox'+paidOrder[i].coverId+'" style="background-color: #fff;"><img src="http://www.youyiku-yishu.cn/'+paidOrder[i].personimg+'" class="shape_'+paidOrder[i].shape+'"></div>';
							}else{
                                booksmes+='<div class="imgbox'+paidOrder[i].coverId+'"></div>';
							}
						booksmes+='<img src="http://www.youyiku-yishu.cn/'+paidOrder[i].goodsThums+'" class="img">';
                        booksmes+='</div>';
							}
						else{
                        booksmes+='<div class="center">';
                        booksmes+='<div class="'+paidOrder[i].css1+'">';
                        booksmes+='<div class="textname">';
                        booksmes+='<div style="text-align:right;font-family: fzxsjt;color: #3C3C3C;font-weight:normal;font-size:0.213333rem;">'+paidOrder[i].bookname+'</div>';
                        booksmes+='<div style="text-align:right;color:#3C3C3C;font-family: fzxsjt;">'+paidOrder[i].author+'·作品</div>';
                        booksmes+='<p >'+paidOrder[i].author+'·作品</p>-->';
                        booksmes+='</div>';
                        booksmes+='</div>';
						if(img.image.toString().indexof('pload')>0){
						booksmes+='<div class="'+paidOrder[i].css2+'">';
						booksmes+='<div class="bookimg">';
						booksmes+='<img src="http://www.youyiku-yishu.cn/'+paidOrder[i].image+'"  class="shape_'+paidOrder[i].shape+'" alt="2">';
						booksmes+='</div>';
						booksmes+='</div>';
						}else{
						booksmes+='<div class="'+paidOrder[i].css2+'">';
						booksmes+='<div class="bookimg">';
						booksmes+='<img src="http://www.youyiku-yishu.cn/'+paidOrder[i].image+'" class="img absolute alt" alt="2">';
						booksmes+='</div>';
						booksmes+='</div>';
						}
						booksmes+='<div id="booktext">优忆库-出品</div>';
                        booksmes+='</div>;'
						}
					    booksmes+='</div>';
					    booksmes+='<input type="hidden" value="'+paidOrder[i].bookType+'" id="bookType">';
					    booksmes+='<div class="book_text">';
					    booksmes+='<div class="style">';
						if(paidOrder[i].bookType==1){
                            booksmes+='微信书';
                        }else if(paidOrder[i].bookType==2){
                            booksmes+='微博书';
                        }else if(paidOrder[i].bookType==3){
                            booksmes+='qq空间书';
                        }else if(paidOrder[i].bookType==4){
                            booksmes+='照片书';
                        }
              			booksmes+='</div>';
              			booksmes+='<p class="shisi">书名：&nbsp;'+paidOrder[i].bookName+'</p>';
						booksmes+='<p class="shisi">作者：&nbsp;'+paidOrder[i].author+'</p>';
						booksmes+='<p class="shisi">页数：&nbsp;'+paidOrder[i].page+'</p>';
						booksmes+='<p class="shisi">时间：&nbsp;'+paidOrder[i].time+'</p>';
						booksmes+='<div class="blueColor">';
						booksmes+='</div>';
						booksmes+='</div>';
						booksmes+='</div>';
						booksmes+='</div>';
						$('.tabulation').html(booksmes);
						$('.order').css('display','none');
				 }
				}else{
					$('.order').css('display','block');
					
				}
				 
       

				 
		})
		}
